package com.juc.forkJoinPool.forkJoinPool10;

import java.util.concurrent.ForkJoinPool;

public class Test3 {

	public static void main(String[] args) throws InterruptedException {
		MyRunnable2 myRunnable =new MyRunnable2();
		ForkJoinPool pool  =new ForkJoinPool();
		pool.execute(myRunnable);
		Thread.sleep(1000);
		pool.shutdownNow();//返回空的list
		pool.execute(myRunnable);
		System.out.println("main end");
		Thread.sleep(Integer.MAX_VALUE);
		
		//shutdown
		//每个任务正常运行 直到结束
		//池关闭后不在允许有新的任务被执行并抛出RejectedExecutionException
		
		//shutdownNow 结合isInterrupted() ==  true 判断
		//立即停止当前正在执行的任务
		//池关闭后不在允许有新的任务被执行并抛出RejectedExecutionException
		
		//shutdownNow 未结合isInterrupted() ==  true 判断
		//每个任务正常运行 直到结束
		//池关闭后不在允许有新的任务被执行并抛出RejectedExecutionException
	}
}
